/*
 * Copyright 2025 arisgo@163.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.arisgo.cloud.web.model;

import com.arisgo.cloud.common.utils.StringUtil;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * 用于entity
 * @author Coulson
 * @since 2021/12/12
 */
public class NumberIdWithTime extends NumberId implements ITime {

    private Long createdBy;
    private LocalDateTime createdDt;
    private Long updatedBy;
    private LocalDateTime updatedDt;
    private Boolean isDeleted;

    @Override
    public LocalDateTime getCreatedDt() {
        return createdDt;
    }

    @Override
    public void setCreatedDt(LocalDateTime createdDt) {
        this.createdDt = createdDt;
    }

    @Override
    public LocalDateTime getUpdatedDt() {
        return updatedDt;
    }

    @Override
    public void setUpdatedDt(LocalDateTime updatedDt) {
        this.updatedDt = updatedDt;
    }

    @Override
    public Long getCreatedBy() {
        return this.createdBy;
    }

    @Override
    public void setCreatedBy(Long createdBy) {
        this.createdBy = createdBy;
    }

    @Override
    public Long getUpdatedBy() {
        return this.updatedBy;
    }

    @Override
    public void setUpdatedBy(Long updatedBy) {
        this.updatedBy = updatedBy;
    }

    @Override
    public Boolean isDeleted() {
        return this.isDeleted;
    }

    @Override
    public void setIsDeleted(Boolean isDeleted) {
        this.isDeleted = isDeleted;
    }

    public static final String IS_DELETED = "is_deleted";
    public static final String CREATED_BY = "created_by";
    public static final String CREATED_DT = "created_dt";
    public static final String UPDATED_BY = "updated_by";
    public static final String UPDATED_DT = "updated_dt";

    public static String[] getDefaultColumnName() {
        List<String> columns = new ArrayList<>(List.of(NumberId.getDefaultColumnName()));
        columns.addAll(new ArrayList<>(List.of(IS_DELETED, CREATED_BY, CREATED_DT, UPDATED_BY, UPDATED_DT)));
        return columns.toArray(new String[6]);
    }

    public static String[] getCamelColumnName() {
        List<String> columns = StringUtil.underlineToCamel(NumberId.ID, IS_DELETED, CREATED_BY, CREATED_DT, UPDATED_BY, UPDATED_DT);
        return columns.toArray(new String[6]);
    }
}
